package com.frxuexi.mdm2203

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import com.frxuexi.apps.view.AppsPage
import com.frxuexi.docments.DocPage
import com.frxuexi.docments.LocalDocPage
import com.frxuexi.lib_base.RouterPath
import com.frxuexi.mdm2203.view.HomePage
import com.frxuexi.mdm2203.view.MessagePage
import com.frxuexi.user.view.MinePage
import com.frxuexi.report.view.CommitReportPage
import com.frxuexi.report.view.ReportPage
import com.frxuexi.sign.view.SignCommitPage
import com.frxuexi.sign.view.SignPage
import com.frxuexi.task.view.TaskDetailPage
import com.frxuexi.task.view.TaskListPage
import com.frxuexi.task.view.TaskPage
import com.frxuexi.user.view.ApproveDetailPage
import com.frxuexi.user.view.ApproveListPage
import com.frxuexi.user.view.AskLeavePage
import com.frxuexi.user.view.LoginPage
import com.frxuexi.user.view.RegisterPage
import com.frxuexi.user.view.UserAskDetailPage
import com.frxuexi.user.view.UserAskListPage

@Composable
fun MyNavHost(navHostController: NavHostController, it: PaddingValues) {
    NavHost(
        navController = navHostController,
        startDestination = RouterPath.HOME_PAGE,
        androidx.compose.ui.Modifier.padding(it)
    ) {
        composable(RouterPath.MESSAGE_PAGE) { MessagePage() }
        composable(RouterPath.HOME_PAGE) { HomePage(navHostController) }
        composable(RouterPath.MINE_PAGE) { MinePage(navHostController) }
        composable(RouterPath.APPS_PAGE) { AppsPage(navHostController) }
        composable(RouterPath.DOC_PAGE) { DocPage(navHostController) }
        composable(RouterPath.LOCAL_PAGE) { LocalDocPage(navHostController) }
        composable(RouterPath.REPORT_PAGE) { ReportPage(navHostController) }
        composable(RouterPath.COMMIT_PAGE + "/{report}") {
            val json = it.arguments?.getString("report", "")
            CommitReportPage(navHostController, json!!)
        }
        composable(RouterPath.SIGN_PAGE) { SignPage(navHostController) }
        composable(RouterPath.SIGN_COMMIT_PAGE) { SignCommitPage(navHostController) }
        composable(RouterPath.REGISTER_PAGE) { RegisterPage(navHostController) }
        composable(RouterPath.LOGIN_PAGE) { LoginPage(navHostController) }
        composable(RouterPath.ASKLEAVE_PAGE) { AskLeavePage(navHostController) }
        composable(RouterPath.ASKLEAVELIST_PAGE) { UserAskListPage(navHostController) }
        composable(RouterPath.USERASKLEAVE_PAGE + "/{ask}") {
            val json = it.arguments?.getString("ask", "")
            UserAskDetailPage(navHostController, json!!)
        }

        composable(RouterPath.APPROVELIST_PAGE) { ApproveListPage(navHostController) }
        composable(RouterPath.APPROVEDETAIL_PAGE + "/{ask}") {
            val json = it.arguments?.getString("ask", "")
            ApproveDetailPage(navHostController, json!!)
        }

        composable(RouterPath.TASK_PAGE) { TaskPage(navHostController) }
        composable(RouterPath.TASKLIST_PAGE) { TaskListPage(navHostController) }
        composable(RouterPath.TASKDETAIL_PAGE + "/{task}") {
            val json = it.arguments?.getString("task", "")
            TaskDetailPage(navHostController, json!!)
        }

    }

}